﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Microsoft.Practices.Prism.Modularity;

namespace AesonPrism.Shell.Tools
{
    public class PrismModuleManager
    {
        internal static void LoadModules(IModuleCatalog ModuleCatalog)
        {
            // Sample
            //RegisterModule(typeof(AccountingModule.AccountingModuleInit),
            //    InitializationMode.WhenAvailable, ModuleCatalog);

            //RegisterModule(typeof(TestSecurityModul.SecurityModuleInitializer),
            //  InitializationMode.WhenAvailable, ModuleCatalog);


        }

        private static void RegisterModule(Type type, InitializationMode initialization,
            IModuleCatalog moduleCatalog)
        {
            Task.Factory.StartNew(() => moduleCatalog.AddModule(new ModuleInfo()
            {
                ModuleName = type.Name,
                ModuleType = type.AssemblyQualifiedName,
                InitializationMode = initialization

            })
            );



        }
    }
}
